package com.example.project.controller;


import com.example.project.entity.Review;
import com.example.project.enums.ReviewStateEnum;
import com.example.project.mapper.ReviewMapper;
import com.example.project.service.ReviewService;
import com.example.project.vo.model.CommonRequest;
import com.example.project.vo.model.DoReviewVo;
import com.example.project.vo.model.Result;
import com.github.pagehelper.PageInfo;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

import javax.annotation.Resource;
import java.util.List;

/**
 * 审核模块

 */

@RestController
@RequestMapping("/review")
@Api(tags = "review")
public class ReviewController {
    /**
     * 服务对象
     */
    @Resource
    private ReviewService reviewService;


    @ApiOperation("分页查询自己的审核任务")
    @GetMapping("/pageMyReview")
    public PageInfo<Review> pageMyReview(CommonRequest request) {
        return this.reviewService.pageMyReview(request);
    }

    @ApiOperation("管理员开始审核")
    @PostMapping("/doReview")
    public void doReview(@RequestBody DoReviewVo doReviewVo) {
        this.reviewService.doReview(doReviewVo);
    }

    @ApiOperation("申请人重新发起审核")
    @GetMapping("/reApply")
    public void reApply(Long reviewId, Long workId) {
        this.reviewService.reApply(reviewId, workId);
    }

    @ApiOperation("查询某个任务的审核进度")
    @GetMapping("/process")
    public List<Review> process(Long workId) {
        return this.reviewService.process(workId);
    }

    @ApiOperation("撤销申请")
    @GetMapping("/annulReview")
    public void annulReview(Long reviewId, Long workId) {
        this.reviewService.annulReview(reviewId, workId);
    }



}

